<template>
  <div id="app">
    <nav-bar-comp 
      :title="titleVal"
      v-if="$store.getters.navBarValStatus"  
    />
    <div class="carContent">
      <transition name="pageOver" mode="out-in">
        <keep-alive>
          <router-view  v-if="isRouterAlive && $route.meta.keepAlive"/>
        </keep-alive>
      </transition>
      <transition name="pageOver" mode="out-in">
        <router-view  v-if="isRouterAlive && !$route.meta.keepAlive"/>
      </transition>
    </div>
  </div>
</template>

<script>
  import NavBarComp from '@/components/navBar/navBar.vue';
  export default {
    name: 'app',
    data() {
      return {
        isRouterAlive: true,
        titleVal:''
      }
    },
    components: {
      NavBarComp
    },
    mounted() {
      this.titleVal = this.$store.getters.navBarVal;
    },
    methods: {
      reload() {
        this.isRouterAlive = false
        this.$nextTick(function(){
          this.isRouterAlive = true
        })
      }
    }
  }
</script>

<style lang="scss">
html,body{
  height: 100%;
  background: #ffffff;
}
#app {
  height: 100%;
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  .van-nav-bar .van-icon{
    color: #FF9900;
  }
  .carContent{
    display: flex;
    flex: 1;
    overflow: scroll;
    overflow-x: hidden;
    overflow-y: auto;
    .pageOver-enter{
      opacity: 0;
      transform: translate(100%,0);
    }
    .pageOver-enter-active{
      transition: all .3s ease;
    }
    .pageOver-leave-active{
       transition: all .3s ease;
    }
    .pageOver-leave-to{
      transform: translateX(-100%);
      opacity: 0;
    }
  }
  // 登录界面样式
  .car_login,.car_registered{
    .van-field__label{
      text-align: left;
      font-size: .28rem;
      color: #666666;
    }
    .van-cell:not(:last-child)::after{
      border-bottom: none;
    }
  }
}
// Toast自定义样式
.default_toast{
  width: 5rem;
  background: #F2F2F2;
  color: #666666;
  font-size: .28rem;
  border-radius: .32rem;
}
.van-overlay{
  background: rgba(0,0,0,.2);
}
.default_loadding{
  background: #F2F2F2;
}
.default_toast .van-toast__text{
  color: #666666;
}
.default_dialog{
  top: 40%!important;
  .van-dialog__footer--buttons{
    justify-content: flex-end;
    .van-button{
      flex: 0;
      flex-basis: 18%;
      font-size: 14px;
    }
  }
  [class*=van-hairline]::after{
    border: none;
  }
  .van-dialog__confirm{
    color: #FF9900!important;
    margin-right: .3rem;
  }
}
.van-dialog__message{
  color: #666666;
}
</style>
